<%@ page language="java" import="java.sql.*"
	contentType="text/html;charset=utf-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>检验插入页面</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--  
    <link rel="stylesheet" type="text/css" href="styles.css">  
    -->

</head>

<body>
	<br>
	<%
		boolean flag = false;
		request.setCharacterEncoding("utf-8");
		String market_id = request.getParameter("market_id");
		String month = request.getParameter("month");
		String rent = request.getParameter("rent");
		String admission_rate = request.getParameter("admission_rate");
		String management_fee = request.getParameter("management_fee");
		String transfer_fee = request.getParameter("transfer_fee");
		String security_num = request.getParameter("security_num");
		String visitors_flowrate = request.getParameter("visitors_flowrate");
		String table_rate = request.getParameter("table_rate");
		String salary_avg = request.getParameter("salary_avg");
		String education_level = request.getParameter("education_level");
		String employee_average = request.getParameter("employee_average");
		String registered_num = request.getParameter("registered_num");
		String ecommerce_change = request.getParameter("ecommerce_change");
		String customized_avg = request.getParameter("customized_avg");  
	%>
	<%
		String driver = "com.mysql.jdbc.Driver";
		String url = "jdbc:mysql://localhost:3306/detecting_system?useUnicode=true&characterEncoding=utf-8";
		String use = "root";
		String password = "";
		Class.forName(driver);
		try{
		Connection conn = DriverManager.getConnection(url, use, password);
		PreparedStatement sql = conn
				.prepareStatement("update market_data set rent=?,admission_rate=?,management_fee=?,transfer_fee=?,security_num=?,visitors_flowrate=?,table_rate=?,salary_avg=?,education_level=?,employee_average=?,registered_num=?,ecommerce_change=?,customized_avg=? where market_id=? AND month=?");
		sql.setString(1, rent);
		sql.setString(2, admission_rate);
		sql.setString(3, management_fee);
		sql.setString(4, transfer_fee);
		sql.setString(5, security_num);
		sql.setString(6, visitors_flowrate);
		sql.setString(7, table_rate);
		sql.setString(8, salary_avg);
		sql.setString(9, education_level);
		sql.setString(10, employee_average);
		sql.setString(11, registered_num);
		sql.setString(12, ecommerce_change);
		sql.setString(13, customized_avg);
		sql.setString(14, market_id);
		sql.setString(15, month);
		int rtn = sql.executeUpdate();
		if (rtn != 0) {
			flag = true;
		}
		sql.close();
		conn.close();
		 }catch (Exception ex) {
			ex.printStackTrace();
		}
	%>
	<!-- 判断是否是插入成功 -->
	<%
		if (flag == true) {
	%>
	<jsp:forward page="insert_success.jsp" />
	<%
		} else if (flag == false) {
	%>
	<jsp:forward page="insert_fail.jsp" />
	<%
		}
	%>
</body>
</html>
